#include <stdio.h>
#include <iostream>
#include <assert.h>
#include <vector>
#include <algorithm>
using namespace std;

struct sticknode{
    int len;
    int used;
    sticknode(int length){
        len = length;
        used = 0;
    }
    bool
    operator == (const struct sticknode node){
        return (len == node.len);
    }
};
typedef vector<struct sticknode> mytype;
typedef mytype::iterator  myiterator;

bool testlen(int sticklen,  myiterator first, myiterator last){
    if(first == last && sticklen != 0){
        return false;
    }
    mytype m(first, last);
    myiterator it = m.begin();
    if(it->used == 0 && )
}

int main(){
    int num;
    mytype data;
    cin >> num;
    while(num != 0){
        // input stick length
        data.clear();
        int maxlen = 0;
        int sumlen = 0;
        for(int i = 0; i < num; i++){
            int l;
            cin >> l;
            sumlen += l;
            if(l > maxlen){
                maxlen = l;
            }
            data.push_back(struct sticknode(l));
        }
        //test the stick length
        for(int len = maxlen; len <= sumlen; len++){
            if(sumlen % len  == 0){
                if(testlen()){
                    cout << len <<endl;
                }
            }
        }


        cin >> num;
    }
    return 0;
}
